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