UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YO4iIkHuOljinzoqnNc9Qr/9SsOiKlSMDcFK+TTrv78='
WHERE
key_id = 'de9d989fd155dd61e418a119fca25170319d0c3cb65e0fe59c68ef6a0ce2d60e'
AND (
token = 'YO4iIkHuOljinzoqnNc9Qr/9SsOiKlSMDcFK+TTrv78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)