UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xoFp20ylA+IZMeGhPNpo37sAzHhLzEp1sYI66NaMiB0=' 
WHERE 
  key_id = 'd0a32ed539b3d61f05fb424297678e3db77c21e6e4f597754c32cd66a2bf8831' 
  AND (
    token = 'xoFp20ylA+IZMeGhPNpo37sAzHhLzEp1sYI66NaMiB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029