UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Umg7dSYAUwaircjjbGaf8Pm+hsiohwXXwSjqc7uEZY=' 
WHERE 
  key_id = '52bafec71666ad2d35223905c74ee7c1eab22c4557c9576e1fa6ce121f8a5539' 
  AND (
    token = '4Umg7dSYAUwaircjjbGaf8Pm+hsiohwXXwSjqc7uEZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035