UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sgPVklp3B3nhQkXAx8hMp5WwQ1DvBFi+rSg3il61V3s=' 
WHERE 
  key_id = '9f22a4834e8ffb8c9d80ee9ca8d1f3a04ed5c091e3c8e4bea07b3396a5f1452b' 
  AND (
    token = 'sgPVklp3B3nhQkXAx8hMp5WwQ1DvBFi+rSg3il61V3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068