UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HgJRUIIOnwBtMVerrm9Ulmg2XdcK6i3ZKH3Q8OI0NaQ='
WHERE
key_id = 'd8d8cdaca74e4da6d49c4ba5c2647309adb24a1032daf1ae3fc79c549f6fc9ff'
AND (
token = 'HgJRUIIOnwBtMVerrm9Ulmg2XdcK6i3ZKH3Q8OI0NaQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)