UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qBGCGMnkkpTVPm1uKAJMSSscNWPXYdRYMqty0hPjszQ=' 
WHERE 
  key_id = '14c4ac648a4090e283d3e01663d403fd1879dd7ae70f2127e84e0a1ddadb2fe9' 
  AND (
    token = 'qBGCGMnkkpTVPm1uKAJMSSscNWPXYdRYMqty0hPjszQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016