UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwV1iXUKiC3b1mrOkUW5Tw7zUXLBgBxCnjnNm6CwNJk=' 
WHERE 
  key_id = '5c8864d94863783d707b083491b1af222414140abd07b202481f493649c97995' 
  AND (
    token = 'AwV1iXUKiC3b1mrOkUW5Tw7zUXLBgBxCnjnNm6CwNJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047