UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/tnSM8y9ksiIaTQhLmz1RDUyc9VOAamXvRZ5GN2Wnb0='
WHERE
key_id = 'eaae9191c71cb6b214652108b46c939517a53a5111c4d3e5726c21d1778eeb4a'
AND (
token = '/tnSM8y9ksiIaTQhLmz1RDUyc9VOAamXvRZ5GN2Wnb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)