UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n1X14PIH7ULiz1Y2Z0dBrX0E6xg7L8UocGAP6yLSMlU=' 
WHERE 
  key_id = '99717eb1c95fc7531059a024f509721c51f4a528657e06536bc74e909f6f70aa' 
  AND (
    token = 'n1X14PIH7ULiz1Y2Z0dBrX0E6xg7L8UocGAP6yLSMlU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035