UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aDPz/B8zUL4L23mJzHg5hu7fLWz5/pDapKM1eVAe/QE=' 
WHERE 
  key_id = '370674337afeeaa254582c24128fba06e7feb4361c5b981aa3c85a0c0ae539d0' 
  AND (
    token = 'aDPz/B8zUL4L23mJzHg5hu7fLWz5/pDapKM1eVAe/QE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047