UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gFme/XjL6Wt+vH5o3osutaOtPcq3E7bQNS9utH7J/+w=' 
WHERE 
  key_id = '10620e4bc652226256f4ba3bacb8162a60436f63a4cd9075d1ca0c193e9ae896' 
  AND (
    token = 'gFme/XjL6Wt+vH5o3osutaOtPcq3E7bQNS9utH7J/+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032