UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HUX9+yvHlSfw3BohnNPT33NZb0ivndu6n4oUrm/qf40='
WHERE
key_id = 'a51a3e9b809155eb5ea0f9f28aaf5da6064fbd114a1c1ed048a8e984c3ee9d4d'
AND (
token = 'HUX9+yvHlSfw3BohnNPT33NZb0ivndu6n4oUrm/qf40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)