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