UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A4bQEe2ZAi4Ev8jyAUOkMBi234dsb9JSmm6jeAUloB8='
WHERE
key_id = '8636bb2fa470590fbf0a87d9c05f522065084d9b57df7ae1cd473efc5a4fa095'
AND (
token = 'A4bQEe2ZAi4Ev8jyAUOkMBi234dsb9JSmm6jeAUloB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)