UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F8zb2o9kXFBzrySTrQydrzW1JRU2mmOAnVzOLdopdI0='
WHERE
key_id = '798469242d5476682031ec862b5d11972df21ca2188d4959d2818fe7dbc34eb8'
AND (
token = 'F8zb2o9kXFBzrySTrQydrzW1JRU2mmOAnVzOLdopdI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)