UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gALZ549/QlsWlXRJJK4nMFspfW60z+gf6NMeh2aO35U='
WHERE
key_id = '4f0d24c8c3f193f13d38faa851ea5e3d6e645ebc563c39ae47050776653f1eed'
AND (
token = 'gALZ549/QlsWlXRJJK4nMFspfW60z+gf6NMeh2aO35U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)