UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g+4oE6tDhsN1EzwyuTElVRVPWA4nibWrSZvDLHXhzv4='
WHERE
key_id = 'cd5edd7245ca2f9b1e0e27cda00e4c78f24cf84e25f9ff5a90f3071714b0a52e'
AND (
token = 'g+4oE6tDhsN1EzwyuTElVRVPWA4nibWrSZvDLHXhzv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)