UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bUyTSdFEKj6rehSM6J4p9Kik6zhfeQvAowfUFxi+pJU='
WHERE
key_id = 'f3831a8946197435cc93486ddb1800c443c9ea6db8eae323ebd6174d752b7e5f'
AND (
token = 'bUyTSdFEKj6rehSM6J4p9Kik6zhfeQvAowfUFxi+pJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)