UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Smc0zxVT0bWBiKtICH04l9ccGDUQ3x+qy5P2X0W+12g=' 
WHERE 
  key_id = '9ee498094dd554b2c8295c9ddc00888d9d021afa863a08f9366986e73247b602' 
  AND (
    token = 'Smc0zxVT0bWBiKtICH04l9ccGDUQ3x+qy5P2X0W+12g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037