UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ip4CRqvMSK9KQd0IaHRD6NcNCh8bi82pZVf6qZLLyds=' 
WHERE 
  key_id = '469b7d53023af68777ac19258802bdbbfb870b85e8e7d6930e8436fa8a301e1d' 
  AND (
    token = 'Ip4CRqvMSK9KQd0IaHRD6NcNCh8bi82pZVf6qZLLyds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051