UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+med31g/j8s9pm6jnfQ2VQjcqbNbimj3hbZ+bIWepD4=' 
WHERE 
  key_id = '5b0f436a3312e1f52e3b36acb4678f711878d7a951932ad1b3e7739ae9dee994' 
  AND (
    token = '+med31g/j8s9pm6jnfQ2VQjcqbNbimj3hbZ+bIWepD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032