UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lSL958L2xrGP8AzgZ6pmnzccTdFZcfiN65gRr/jUefc=' 
WHERE 
  key_id = '105e0f45b43991cfd72db72df521d2ed899ef9f3b597ff150a74df39c1525bca' 
  AND (
    token = 'lSL958L2xrGP8AzgZ6pmnzccTdFZcfiN65gRr/jUefc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052