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