UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XYdFUHtU9vgZCYi++498LyDH22rZAPPXhLW2hsOF7y4='
WHERE
key_id = '46abe8742b47466c074fa44f5b2c3f1e24b24301e343e3f074b2a6432fc50248'
AND (
token = 'XYdFUHtU9vgZCYi++498LyDH22rZAPPXhLW2hsOF7y4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)