UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COfBUIGf6AmW9peVVyBjDWOzb1WoB+J6/XCt0YXXe4g='
WHERE
key_id = 'ef8896d21826ef6bdf0eca95de474526b8539cfdc7895795df65665f6a855488'
AND (
token = 'COfBUIGf6AmW9peVVyBjDWOzb1WoB+J6/XCt0YXXe4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)