UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MbhhXTNLtU+MwjlLPt50KKv/o/lJASx0nlk7L3mpPGw='
WHERE
key_id = 'b5023fa44d984aba70c8256580a3912d40c69ffc102cccabcc04851684a0ed26'
AND (
token = 'MbhhXTNLtU+MwjlLPt50KKv/o/lJASx0nlk7L3mpPGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)