UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CUEj0TycFxDbhmiTVUJE9IoE1tImToVIQktOgAst2Ws=' 
WHERE 
  key_id = '8ea1436f3fc4ae0b97ade31b1dd6639060253b551635feba47382b19179f8aea' 
  AND (
    token = 'CUEj0TycFxDbhmiTVUJE9IoE1tImToVIQktOgAst2Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021