UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSo8P62eVXDXxIhvdZh4j6iADx1muijkKJwdrZY5auA=' 
WHERE 
  key_id = '2c40b5688d8225cab4e499389653a731790fd3d4ba653b4739c19c7f370795a3' 
  AND (
    token = 'KSo8P62eVXDXxIhvdZh4j6iADx1muijkKJwdrZY5auA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022