UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O+/W+b3bHtZVgtdSoV71BkYH1OonaLHJxG/Sf75mYX0='
WHERE
key_id = 'cd9eaff4732b98754afdd199c3c848cb127c199c1b5b8c4916706c31963d1466'
AND (
token = 'O+/W+b3bHtZVgtdSoV71BkYH1OonaLHJxG/Sf75mYX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)