UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgUkaBKECl87sNbaB1+wPs1y977Bu3UeqlAOg9I0nj4=' 
WHERE 
  key_id = 'f59d5d036b7df13a819d0856f77e0c2247e6ec228b36ad9ab5c2e232e995b9e0' 
  AND (
    token = 'EgUkaBKECl87sNbaB1+wPs1y977Bu3UeqlAOg9I0nj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047