UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Y5vt266HJlM/3XGKJpZJ1VYBTwEwveLaDLcseoxk5U=' 
WHERE 
  key_id = 'a8b61c520f2268398176770434257dbcd0d9d23e34cbbd9e145cbb69041f069e' 
  AND (
    token = '6Y5vt266HJlM/3XGKJpZJ1VYBTwEwveLaDLcseoxk5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038