UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N8Pr+Zmvoo/R7pPfjnx0eJt3uVcx2mkYHWeLF0Evmts=' 
WHERE 
  key_id = 'f1c2e2167a2315ea66b38f1203eace53d374e5ce536bbda39cb00ae96d913690' 
  AND (
    token = 'N8Pr+Zmvoo/R7pPfjnx0eJt3uVcx2mkYHWeLF0Evmts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045