UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Sgz4/q+99unzS/EthItWVTyuizYTnBwcBOa2cOKiiE=' 
WHERE 
  key_id = 'dc3cf3e6f82439b78e0804a6ee61d71cbabe367cc9f0fa38f69d22be52d60a09' 
  AND (
    token = '2Sgz4/q+99unzS/EthItWVTyuizYTnBwcBOa2cOKiiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025