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