UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IBWIj3FybytT3fse4eJbI60uksXvCBLmu8/5O1ZhTRc='
WHERE
key_id = 'fd942c3aad1f5414d886b681c61ad84ea766894d2fee314d734e03d81e3e060f'
AND (
token = 'IBWIj3FybytT3fse4eJbI60uksXvCBLmu8/5O1ZhTRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)