UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6cRrwO7zYiJSP4MYJEY80x5vPzEAP0GwmWWkq2dRIfg='
WHERE
key_id = '3d4dc9c041773cdb621c907b92e31ccdfa43887faa66f85d9c098aed18349677'
AND (
token = '6cRrwO7zYiJSP4MYJEY80x5vPzEAP0GwmWWkq2dRIfg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)