UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ySAyWrUh0RnGK8qksXFsTXVWkT8uDrqa1oUCY1+226c=' 
WHERE 
  key_id = '93fb295edeae1a06fb58f837fc2c6327ff994cf714535059ae468d3d327299f5' 
  AND (
    token = 'ySAyWrUh0RnGK8qksXFsTXVWkT8uDrqa1oUCY1+226c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048