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