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