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