UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zIeJMJmFTqVH/ToRewN79PymxOzEy5ro9wiPnBMPrF0='
WHERE
key_id = 'd9ae366ecd96ae37442ffa90e13a4a3d902ac436e1a24df47550ca3446e21b6e'
AND (
token = 'zIeJMJmFTqVH/ToRewN79PymxOzEy5ro9wiPnBMPrF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)