UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Hv+M32oZGjjOPrKuMrLwxnJtoRZLOPlAWfwd+XYiAc=' 
WHERE 
  key_id = '959800a8ba6aa543af7914470366f6de017af08792081cda54b27f2279964375' 
  AND (
    token = '4Hv+M32oZGjjOPrKuMrLwxnJtoRZLOPlAWfwd+XYiAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016