UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mos4bKAZaayrjZ1zlxv/ZGw49UpnSaCcsny+IGxltGY='
WHERE
key_id = 'cc248f0c20ba90c5b1119d673a4532bfa2089339bac9f23092210335b4841818'
AND (
token = 'Mos4bKAZaayrjZ1zlxv/ZGw49UpnSaCcsny+IGxltGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)