UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iizkb0F2734mQAKjYUqzrU1DQXQMpBbs8XYBtl5NeoA=' 
WHERE 
  key_id = '1610b1d9e8aecddac3836a5dc346706633eba563bf32dab87bea8722c69a62e1' 
  AND (
    token = 'Iizkb0F2734mQAKjYUqzrU1DQXQMpBbs8XYBtl5NeoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031