UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cw3by8H9o/X+DF5igR70cIeFOkzSUr/ZKYUHc41NsN8='
WHERE
key_id = 'b74342b4516a8274f4dae67ed06a9e802ae45404fa05f2d16ca81a77f450edab'
AND (
token = 'cw3by8H9o/X+DF5igR70cIeFOkzSUr/ZKYUHc41NsN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)